/**
 */
package mobilex.impl;

import mobilex.AppMobile;
import mobilex.MobilexPackage;
import mobilex.Setting;
import mobilex.View;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>App Mobile</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link mobilex.impl.AppMobileImpl#getName <em>Name</em>}</li>
 *   <li>{@link mobilex.impl.AppMobileImpl#getTarget <em>Target</em>}</li>
 *   <li>{@link mobilex.impl.AppMobileImpl#getDeveloper <em>Developer</em>}</li>
 *   <li>{@link mobilex.impl.AppMobileImpl#getSetting <em>Setting</em>}</li>
 *   <li>{@link mobilex.impl.AppMobileImpl#getViewMain <em>View Main</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class AppMobileImpl extends EObjectImpl implements AppMobile {
	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected String name = NAME_EDEFAULT;

	/**
	 * The default value of the '{@link #getTarget() <em>Target</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTarget()
	 * @generated
	 * @ordered
	 */
	protected static final Integer TARGET_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getTarget() <em>Target</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTarget()
	 * @generated
	 * @ordered
	 */
	protected Integer target = TARGET_EDEFAULT;

	/**
	 * The default value of the '{@link #getDeveloper() <em>Developer</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDeveloper()
	 * @generated
	 * @ordered
	 */
	protected static final String DEVELOPER_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getDeveloper() <em>Developer</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDeveloper()
	 * @generated
	 * @ordered
	 */
	protected String developer = DEVELOPER_EDEFAULT;

	/**
	 * The cached value of the '{@link #getSetting() <em>Setting</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSetting()
	 * @generated
	 * @ordered
	 */
	protected Setting setting;

	/**
	 * The cached value of the '{@link #getViewMain() <em>View Main</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getViewMain()
	 * @generated
	 * @ordered
	 */
	protected View viewMain;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AppMobileImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return MobilexPackage.Literals.APP_MOBILE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getName() {
		return name;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(String newName) {
		String oldName = name;
		name = newName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MobilexPackage.APP_MOBILE__NAME, oldName, name));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Integer getTarget() {
		return target;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTarget(Integer newTarget) {
		Integer oldTarget = target;
		target = newTarget;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MobilexPackage.APP_MOBILE__TARGET, oldTarget, target));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getDeveloper() {
		return developer;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDeveloper(String newDeveloper) {
		String oldDeveloper = developer;
		developer = newDeveloper;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MobilexPackage.APP_MOBILE__DEVELOPER, oldDeveloper, developer));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Setting getSetting() {
		return setting;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetSetting(Setting newSetting, NotificationChain msgs) {
		Setting oldSetting = setting;
		setting = newSetting;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MobilexPackage.APP_MOBILE__SETTING, oldSetting, newSetting);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSetting(Setting newSetting) {
		if (newSetting != setting) {
			NotificationChain msgs = null;
			if (setting != null)
				msgs = ((InternalEObject)setting).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MobilexPackage.APP_MOBILE__SETTING, null, msgs);
			if (newSetting != null)
				msgs = ((InternalEObject)newSetting).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MobilexPackage.APP_MOBILE__SETTING, null, msgs);
			msgs = basicSetSetting(newSetting, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MobilexPackage.APP_MOBILE__SETTING, newSetting, newSetting));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public View getViewMain() {
		return viewMain;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetViewMain(View newViewMain, NotificationChain msgs) {
		View oldViewMain = viewMain;
		viewMain = newViewMain;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MobilexPackage.APP_MOBILE__VIEW_MAIN, oldViewMain, newViewMain);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setViewMain(View newViewMain) {
		if (newViewMain != viewMain) {
			NotificationChain msgs = null;
			if (viewMain != null)
				msgs = ((InternalEObject)viewMain).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MobilexPackage.APP_MOBILE__VIEW_MAIN, null, msgs);
			if (newViewMain != null)
				msgs = ((InternalEObject)newViewMain).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MobilexPackage.APP_MOBILE__VIEW_MAIN, null, msgs);
			msgs = basicSetViewMain(newViewMain, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MobilexPackage.APP_MOBILE__VIEW_MAIN, newViewMain, newViewMain));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case MobilexPackage.APP_MOBILE__SETTING:
				return basicSetSetting(null, msgs);
			case MobilexPackage.APP_MOBILE__VIEW_MAIN:
				return basicSetViewMain(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case MobilexPackage.APP_MOBILE__NAME:
				return getName();
			case MobilexPackage.APP_MOBILE__TARGET:
				return getTarget();
			case MobilexPackage.APP_MOBILE__DEVELOPER:
				return getDeveloper();
			case MobilexPackage.APP_MOBILE__SETTING:
				return getSetting();
			case MobilexPackage.APP_MOBILE__VIEW_MAIN:
				return getViewMain();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case MobilexPackage.APP_MOBILE__NAME:
				setName((String)newValue);
				return;
			case MobilexPackage.APP_MOBILE__TARGET:
				setTarget((Integer)newValue);
				return;
			case MobilexPackage.APP_MOBILE__DEVELOPER:
				setDeveloper((String)newValue);
				return;
			case MobilexPackage.APP_MOBILE__SETTING:
				setSetting((Setting)newValue);
				return;
			case MobilexPackage.APP_MOBILE__VIEW_MAIN:
				setViewMain((View)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case MobilexPackage.APP_MOBILE__NAME:
				setName(NAME_EDEFAULT);
				return;
			case MobilexPackage.APP_MOBILE__TARGET:
				setTarget(TARGET_EDEFAULT);
				return;
			case MobilexPackage.APP_MOBILE__DEVELOPER:
				setDeveloper(DEVELOPER_EDEFAULT);
				return;
			case MobilexPackage.APP_MOBILE__SETTING:
				setSetting((Setting)null);
				return;
			case MobilexPackage.APP_MOBILE__VIEW_MAIN:
				setViewMain((View)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case MobilexPackage.APP_MOBILE__NAME:
				return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
			case MobilexPackage.APP_MOBILE__TARGET:
				return TARGET_EDEFAULT == null ? target != null : !TARGET_EDEFAULT.equals(target);
			case MobilexPackage.APP_MOBILE__DEVELOPER:
				return DEVELOPER_EDEFAULT == null ? developer != null : !DEVELOPER_EDEFAULT.equals(developer);
			case MobilexPackage.APP_MOBILE__SETTING:
				return setting != null;
			case MobilexPackage.APP_MOBILE__VIEW_MAIN:
				return viewMain != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (name: ");
		result.append(name);
		result.append(", target: ");
		result.append(target);
		result.append(", developer: ");
		result.append(developer);
		result.append(')');
		return result.toString();
	}

} //AppMobileImpl
